import axiosInstance from '@/api/axiosInstance'
interface AdditionalTypeListParams {
  name?: string
  // 其他查詢條件...
}

// 獲取指定服務列表
export const getAdditionalTypeList = async (params?: AdditionalTypeListParams) => {
  return axiosInstance.get('/admin/additional-type', { params })
}

export const createAdditionalType = async (data: any) => {
  return axiosInstance.post(`/admin/additional-type`, data)
}

// 更新指定服務
export const updateAdditionalType = async (id: number, data: any) => {
  return axiosInstance.put(`/admin/additional-type/${id}`, data)
}

export const deleteAdditionalType = async (id: number) => {
  return axiosInstance.delete(`/admin/additional-type/${id}`)
}


// 創建指定服務子項
export const createAdditionalTypeItem = async (data: any,type:number) => {
  return axiosInstance.post(`/admin/additional-type/${type}/share_rule`, data)
}

// 更新指定服務子項
export const updateAdditionalTypeItem = async (id: number, type:number, data: any) => {
  return axiosInstance.put(`/admin/additional-type/${type}/share_rule/${id}`, data)
}

// 刪除指定服務子項
export const deleteAdditionalTypeItem = async (id: number,type:number) => {
  return axiosInstance.delete(`/admin/additional-type/${type}/share-rule/${id}`)
}

// 導出
export const exportAdditionalShareList = async () => {
  return axiosInstance.get('/admin/additional-type/export-share-rules', { responseType: 'blob', timeout: 60000 })
}



